import Cookies from 'js-cookie';

const TOKEN_KEY = 'token';
const expire = 15;

export function getToken() {
  return Cookies.get(TOKEN_KEY);
}

export function setToken(token, byExpire = false) {
  if (byExpire) {
    return Cookies.set(TOKEN_KEY, token, { expires: expire });
  }
  return Cookies.set(TOKEN_KEY, token);
}

export function removeToken() {
  return Cookies.remove(TOKEN_KEY);
}
